#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys

import mediafile

def create_tables():
	import database
	print('Create tables..')
	db_metadatas_to_create = (mediafile.Audiofile.metadata,) # Depended tables are created automatically (eg. Tag) 
	db = database.Database()
	for db_metadata in db_metadatas_to_create:
		db_metadata.create_all(db.engine)
	print('Done!\nexiting..')

if __name__ == '__main__':
	if len(sys.argv) == 2:
		if sys.argv[1] == 'create_tables':
				create_tables()
		else:
			print('non-existing operation specified, look into source!\nexiting..')
	else:
		print('no operation specified, look into source!\nexiting..')
